﻿$(document).ready(function () {
    //$("#subContent .leftNav").load("/OperationManage/Tree");
    $("#subNav span").click(function () {
        var index = $("#subNav span").index($(this));
        //alert(index);
        if ("0" == index) {
            $("#subNav span").removeClass("selectedNav");
            $("#subNav span").eq(0).addClass("selectedNav");
            var item = $("#top_menu li:first").attr("id");
            $("#top_menu li").removeClass("selectedNav");
            $("#top_menu li:first").addClass("selectedNav");

            //$("#subContent .rightContent").load("/Dictionary/Index/" + item);
            var url1 = "/Dictionary/Index/" + item;
            ajaxLoad("#subContent .rightContent", url1);
        }
        else {
            loadContent(index);
        } 
    });

    //loadContent(0);
    $("#subNav span").removeClass("selectedNav");
    $("#subNav span").eq(0).addClass("selectedNav");
    var item = $("#top_menu li:first").attr("id");
    $("#top_menu li:first").addClass("selectedNav");
    //alert(item);
    //$("#subContent .rightContent").load($("#subNav span").eq(0).attr("data-href")+"/"+item);
    var url2 = $("#subNav span").eq(0).attr("data-href") + "/" + item;
    ajaxLoad("#subContent .rightContent", url2);
});

function loadContent(index) {
    $("#subNav span").removeClass("selectedNav");
    $("#subNav span").eq(index).addClass("selectedNav");

    //$("#subContent .rightContent").load($("#subNav span").eq(index).attr("data-href"));
    var url = $("#subNav span").eq(index).attr("data-href");
    ajaxLoad("#subContent .rightContent", url);
}
